home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 8
/
Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO
/
047a
/
lex_yacc.arj
/
EXPRLEX.L
< prev
next >
Wrap
Text File
|
1989-11-21
|
472b
|
27 lines
(* EXPRLEX.L: lexical analyzer for EXPR.Y *)
{$I expr.h}
digit [0-9]
real {digit}+(\.{digit}+)?([Ee][+\-]?{digit}+)?
%%
var result : integer;
{real} begin
val(yytext, yylval.number, result);
if result=0 then
return(NUMBER)
else
return(ILLEGAL)
end;
[a-zA-Z] begin
yylval.variable := succ(ord(upcase(yytext[1]))-ord('A'));
return(VARIABLE)
end;
^\. return(EOF);
. |
\n return(ord(yytext[1]));